home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Applications / Demos_Demo folder / Demos_Info folder / Demos™ Demonstration / More Examples / More Discrete Distributions < prev    next >
Text File  |  1994-03-21  |  7KB  |  325 lines

  1. { From user Brian Sterling, Project Discdist at Mon, Mar 21, 1994 10:53 AM}
  2.  
  3.  
  4. { System Variables with non-default values: }
  5. Samplesize := 200
  6. Windows := 2
  7. Typechecking := 1
  8. Checking := 1
  9. Saveoptions := 2
  10. Savevalues := 0
  11.  
  12.  
  13. { Non-default Time SysVar value: }
  14. Time := [0,1,2]
  15.  
  16. Attribute Reference
  17.  
  18. Attribute Date_bough
  19.  
  20. Project Discdist
  21. Title: More Discrete Distributions
  22. Description: Additional discrete distributions implemented using a ~
  23. user-defined function.~
  24. ~
  25. This example also shows how to force Demos™ to display a ~
  26. discrete probability distribution as a probability mass ~
  27. function.~
  28. ~
  29. Note:  You must edit 'x index' (or x2 if you use 
  30. Hypergeometric) to span the range of your x values.  This is~
  31. a hack that will hopefully not be necessary in future ~
  32. versions of Demos.~
  33.  
  34. Author: Brian Sterling
  35. Date: Fri, Feb 4, 1994 11:14 AM
  36. Saveauthor: Brian Sterling
  37. Savedate: Mon, Mar 21, 1994 10:53 AM
  38. Diagstate: 1,82,40,346,393,1
  39. Fileinfo: 0,-4,11516,Project Discdist,More Discrete Distributions
  40. Getresource Pagesetup,1
  41.  
  42. Index Xindex
  43. Title: x index
  44. Description: Index for the x values.~
  45. ~
  46. Edit this to span the range of your x values.
  47. Definition: sequence(0,30)
  48. Location: 80,320
  49. Nodesize: 48,20
  50. Nodeinfo: 1,1,1,1,1,1,0
  51.  
  52. Function Choose(m,n)
  53. Title: choose(m,n)
  54. Description: A function that returns the binomial coefficient m!/n!(m-n)!~
  55. Used in the Binomial Pdf and Hypergeometric Pdf functions.
  56. Definition: factorial(m)/(factorial(n)*factorial(m-n))
  57. Location: 80,264
  58. Nodesize: 48,20
  59. Paramnames: M, N
  60.  
  61. Index X2
  62. Title: x2
  63. Description: A shorter index for the x values.~
  64. ~
  65. If you use the Hypergeometric distribution, edit this to span~
  66. the range of your x values.
  67. Definition: sequence(0,8)
  68. Location: 200,320
  69. Nodesize: 48,20
  70.  
  71. Model Pdfs
  72. Title: PDFs
  73. Description: Probability density functions ~
  74. for these distributions.  Used ~
  75. in calculating the distributions.
  76. Author: Brian Sterling
  77. Date: Mon, Feb 28, 1994 10:51 PM
  78. Location: 200,264
  79. Nodesize: 48,20
  80. Diagstate: 1,228,72,213,283,1
  81.  
  82. Function Poisson_pd(alpha,x)
  83. Title: Poisson Pdf~
  84. (alpha,x)
  85. Description: Functional form of Poisson PDF.
  86. Definition: (alpha^x)*Exp( -alpha )/Factorial(x)
  87. Location: 88,208
  88. Nodesize: 48,20
  89. Paramnames: Alpha, X
  90.  
  91. Function Binom_pdf(n,p,x)
  92. Title: Binomial Pdf~
  93. (n,p,x)
  94. Definition: if p=1 and n=x then 1 else choose(n,x) * p^x * (1-p)^(n-x)
  95. Location: 88,40
  96. Nodesize: 48,20
  97. Paramnames: N, P, X
  98.  
  99. Function Geo_pdf(p,x)
  100. Title: Geometric Pdf~
  101. (p,x)
  102. Definition: p*(1-p)^x
  103. Location: 88,96
  104. Nodesize: 48,20
  105. Paramnames: P, X
  106.  
  107. Function Hyper_pdf(n,D,M,x)
  108. Title: Hypergeometric Pdf(n,D,M,x)
  109. Definition: choose(D,x)*choose(M-D,n-x)/choose(M,n)
  110. Location: 88,152
  111. Nodesize: 52,20
  112. Paramnames: N, D, M, X
  113.  
  114. Close Pdfs
  115.  
  116. Function Poisson(alpha)
  117. Title: Poisson(alpha)
  118. Description: The Poisson distribution - alpha is the rate.
  119. Definition: Chancedist(Xindex,Poisson_pd(alpha,Xindex),
  120. Xindex)
  121. Location: 200,120
  122. Nodesize: 48,20
  123. Paramnames: Alpha
  124.  
  125. Function Binomial(n,p)
  126. Title: Binomial(n,p)
  127. Description: The binomial distribution - n is the number of trials, p is the probability.
  128. Definition: Chancedist(xindex,Binom_pdf(N, P,xindex),xindex)
  129. Location: 80,56
  130. Nodesize: 48,20
  131. Paramnames: N, P
  132.  
  133. Function Geometric(p)
  134. Title: Geometric(p)
  135. Description: The geometric distribution - p is the probability.
  136. Definition: Chancedist(Xindex,Geo_pdf(p,Xindex),Xindex)
  137. Location: 200,56
  138. Nodesize: 48,20
  139. Paramnames: P
  140.  
  141. Function Hypergeo(n,D,M)
  142. Title: Hypergeometric(n,D,M)
  143. Description: The hypergeometric distribution - n is the sample size, D is the expected number of one outcome, M is the population size.
  144. Definition: Chancedist(X2,Hyper_pdf(n,D,M,X2),X2)
  145. Location: 80,120
  146. Nodesize: 52,20
  147. Paramnames: N, D, M
  148.  
  149. Model Examples
  150. Title: Examples
  151. Description: Examples of the use of these distributions.~
  152. x index (or x2 for Hypergeometric) must be edited to span the x-values of your distribution.
  153. Author: Brian Sterling
  154. Date: Mon, Feb 28, 1994 10:51 PM
  155. Location: 136,184
  156. Nodesize: 48,20
  157. Diagstate: 1,439,112,363,255,1
  158.  
  159. Chance Poisson_ex
  160. Title: Poisson Ex.
  161. Description: An example showing how to display the Poisson~
  162. distribution as a probability mass function.
  163. Definition: Frequency( Poisson(12), Xindex ) / samplesize
  164. Location: 80,208
  165. Nodesize: 48,20
  166. Valuestate: 1,51,550,608,293,1,MIDM
  167. Graphsetup: Distresol:4~
  168. Diststeps:1~
  169. Symbolsize:6~
  170. Linestyle:9~
  171. Frame:1~
  172. Grid:1~
  173. Ticks:1~
  174. Mesh:1~
  175. Scales:1~
  176. Frameauto:1~
  177. Xminimum:0~
  178. Xmaximum:30~
  179. Yminimum:0~
  180. Ymaximum:1~
  181. Zminimum:1~
  182. Zmaximum:15~
  183. Xintervals:0~
  184. Yintervals:0~
  185.  
  186. Reformval:           [Xindex    ,Undefined ]
  187.  
  188. Chance Binomial_ex
  189. Title: Binomial Ex.
  190. Description: An example showing how to display the Binomial~
  191. distribution as a probability mass function.~
  192. The first argument of Binomial() must be edited to equal the maximum value of the index 'x index'.
  193. Definition: Frequency( Binomial(30,0.8), Xindex ) / samplesize
  194. Location: 80,40
  195. Nodesize: 48,20
  196. Valuestate: 1,455,461,619,288,1,MIDM
  197. Graphsetup: Distresol:4~
  198. Diststeps:1~
  199. Symbolsize:6~
  200. Linestyle:9~
  201. Frame:1~
  202. Grid:1~
  203. Ticks:1~
  204. Mesh:1~
  205. Scales:1~
  206. Frameauto:1~
  207. Xminimum:0~
  208. Xmaximum:30~
  209. Yminimum:0~
  210. Ymaximum:0.2~
  211. Zminimum:1~
  212. Zmaximum:1~
  213. Xintervals:0~
  214. Yintervals:0~
  215.  
  216. Reformval:           [Xindex    ,Undefined ]
  217.  
  218. Chance Geometric_ex
  219. Title: Geometric Ex.
  220. Description: An example showing how to display the Geometric~
  221. distribution as a probability mass function.
  222. Definition: Frequency( Geometric(0.3), Xindex ) / samplesize
  223. Location: 80,96
  224. Nodesize: 48,20
  225. Valuestate: 1,403,465,416,303,1,MIDM
  226. Graphsetup: Distresol:4~
  227. Diststeps:1~
  228. Symbolsize:6~
  229. Linestyle:9~
  230. Frame:1~
  231. Grid:1~
  232. Ticks:1~
  233. Mesh:1~
  234. Scales:1~
  235. Frameauto:1~
  236. Xminimum:0~
  237. Xmaximum:30~
  238. Yminimum:0~
  239. Ymaximum:1~
  240. Zminimum:1~
  241. Zmaximum:1~
  242. Xintervals:0~
  243. Yintervals:0~
  244.  
  245. Reformval:           [Xindex    ,Undefined ]
  246.  
  247. Chance Hypergeo_ex
  248. Title: Hypergeo Ex.
  249. Description: An example showing how to display the Hypergeometric~
  250. distribution as a probability mass function.~
  251. The first argument of Hypergeo() must equal the maximum value of the index x2.
  252. Definition: Frequency( Hypergeo(8,17,30), X2 ) / samplesize
  253. Location: 80,152
  254. Nodesize: 48,20
  255. Valuestate: 1,314,481,416,303,1,MIDM
  256. Graphsetup: Distresol:4~
  257. Diststeps:1~
  258. Symbolsize:6~
  259. Linestyle:9~
  260. Frame:1~
  261. Grid:1~
  262. Ticks:1~
  263. Mesh:1~
  264. Scales:1~
  265. Frameauto:1~
  266. Xminimum:0~
  267. Xmaximum:30~
  268. Yminimum:0~
  269. Ymaximum:1~
  270. Zminimum:1~
  271. Zmaximum:1~
  272. Xintervals:0~
  273. Yintervals:0~
  274.  
  275. Reformval:           [Xindex    ,Undefined ]
  276.  
  277. Index Bern_out
  278. Title: Bernoulli outcomes
  279. Description: A list of the possible outcomes of the Bernoulli distribution. ~
  280. This is needed in order to display the Bernoulli distribution as ~
  281. a probability mass function.
  282. Definition: [0,1]
  283. Location: 208,40
  284. Nodesize: 48,20
  285.  
  286. Chance Bernoulli_1
  287. Title: Bernoulli Ex.
  288. Description: Example of the built-in Bernoulli distribution.
  289. Definition: Bernoulli(0.3)
  290. Location: 208,96
  291. Nodesize: 48,20
  292.  
  293. Chance Bernprobmass
  294. Title: Bernoulli Prob Mass
  295. Description: An example showing how to display the builtin Bernoulli ~
  296. distribution as a probability mass function.
  297. Definition: Frequency(Bernoulli_1,Bern_out)/samplesize
  298. Location: 208,152
  299. Nodesize: 48,20
  300. Valuestate: 1,232,242,416,303,1,MIDM
  301. Graphsetup: Distresol:4~
  302. Diststeps:1~
  303. Symbolsize:6~
  304. Linestyle:9~
  305. Frame:1~
  306. Grid:1~
  307. Ticks:1~
  308. Mesh:1~
  309. Scales:1~
  310. Frameauto:1~
  311. Xminimum:0~
  312. Xmaximum:1~
  313. Yminimum:0~
  314. Ymaximum:1~
  315. Zminimum:1~
  316. Zmaximum:1~
  317. Xintervals:0~
  318. Yintervals:0~
  319.  
  320.  
  321. Close Examples
  322.  
  323. Close Discdist
  324.  
  325.